<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>音频播放测试</title>
</head>
<body>
    <h1>音频播放测试</h1>
    
    <div>
        <h2>测试1: 直接播放Kodo URL</h2>
        <button onclick="testKodoAudio()">播放Kodo音频</button>
        <audio id="audio1" controls></audio>
    </div>
    
    <div>
        <h2>测试2: 通过JavaScript播放</h2>
        <button onclick="testJsAudio()">JavaScript播放</button>
        <div id="status"></div>
    </div>
    
    <script>
        function testKodoAudio() {
            // 这里需要替换为实际的Kodo URL
            const audioUrl = 'http://t3320eebr.hd-bkt.clouddn.com/audio/2025-01-26/test.mp3';
            const audio = document.getElementById('audio1');
            audio.src = audioUrl;
            audio.play().catch(e => {
                console.error('播放失败:', e);
                document.getElementById('status').innerHTML = '播放失败: ' + e.message;
            });
        }
        
        function testJsAudio() {
            // 这里需要替换为实际的Kodo URL
            const audioUrl = 'http://t3320eebr.hd-bkt.clouddn.com/audio/2025-01-26/test.mp3';
            const audio = new Audio(audioUrl);
            
            audio.addEventListener('canplaythrough', () => {
                document.getElementById('status').innerHTML = '音频可以播放';
                audio.play().catch(e => {
                    console.error('播放失败:', e);
                    document.getElementById('status').innerHTML = '播放失败: ' + e.message;
                });
            });
            
            audio.addEventListener('error', (e) => {
                console.error('音频加载失败:', e);
                document.getElementById('status').innerHTML = '音频加载失败: ' + e.message;
            });
            
            audio.addEventListener('ended', () => {
                document.getElementById('status').innerHTML = '播放完成';
            });
        }
    </script>
</body>
</html>
